<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
</head>
<body>
    <button @click="">立即支付</button>
</body>
<script>
    function onBridgeReady() {
        WeixinJSBridge.invoke('getBrandWCPayRequest', {
                "appId": "wxd48904d5ec186e12",
                "timeStamp": "1649221370",
                "nonceStr": "F1xFYBAVwTdKJK3OudasYOgPgmQFf7r9",
                "package": "prepay_id=wx0613024973366284be4303a302f4d00000",
                "signType": "RSA",
                "paySign": "fZhn5pJjzai5Kqifi9CXb1pPxHe39JYvLqNuHNvs0JI/OEQx5nxM789l+/JE/wuEyH5L5XXCia+rlC/0LPT/Vfq2zs7FLYkFfP13nTv7EnYMSWUm+YlLUX9gM6jqd5UTm8SSRImKQBsV9VlNY8HyCHtTDctNXRsVMOaLBPeoll9JKd594fT9pE0JqZq/NnqcJXXcTXwLxlN/sWyc0JfXp45lvX6SIx+BqAk3oxZXxS4tKrcW97crDHNEr9oK+izDu0Ekyyg0qkLWcdr77b9G6ojxLnP4+ByRuO/cv+VmNqD+imy6smItOEXUGB8e8a/tV0VGqzCoK9QEDQdjC3AdzA=="
            },
            function(res) {
                if (res.err_msg == "get_brand_wcpay_request:ok") {
                    // 使用以上方式判断前端返回,微信团队郑重提示：
                    //res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
                }
                console.log(res)
            });
    }
    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }
</script>
</html>
